/*************************************************************************
	> File Name: B3882.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-04-15 13:47:43
 ************************************************************************/

#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int check(int n) {
    string s = to_string(n);
    string s2 = s;
    reverse(s2.begin(), s2.end());
    return s == s2;
}

int main() {
    int n, cnt = 0;
    cin >> n;
    for (int i = 1; i < n; i++) {
        cnt += check(i);
    }
    cout << cnt << endl;
    return 0;
}
